#include<stdio.h>
#define P1 0.4983
#define P2 0.5483
#define P3 0.7983
int main()
{
    int n,i,ws[1000];
    double sum;
    scanf("%d",&n);
    for(i=0;i<=n-1;i++)
    {
        scanf("%d",&ws[i]);
    }
    for (i=0;i<=n-1;i++)
    {
        if (ws[i]<=230)
        {
            sum = P1 * ws[i];
        }
        else if(ws[i]<=420&&ws[i]>=231)
        {
            sum=230*P1+(ws[i]-230)*P2;
        }
        else 
        {
            sum=230*P1+190*P2+(ws[i]-420)*P3;
        }
        i==n-1?printf("%.2lf",sum):printf("%.2lf\n",sum);
    }
}
